"Script_name: http.vim
"Author: niuyabeng@126.com
"Date: 2019/08/12
"Release: 0.1
"Description: syntax for http packet
"Language: http
"Location: $HOME/.vim/syntax or $VIMRUNTIME/syntax/
"Install_detail:
        "1. put this file in $HOME/.vim/syntax or $VIMRUNTIME/syntax/ 
        "2. Add the following line in your .vimrc:
        "syntax on "syntax highlighting on
        "filetype plugin on
        "au BufRead,BufNewFile *.http setlocal ft=http "syntax highlight for http.vim 

"set case insensitive.
syn case ignore

"This script is encoded as utf8, and will convert to appropriate value when running.
scriptencoding utf-8

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" key words definition.
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Keywords
syn match httpRequestLine '\(GET\|POST\|PUT\|HEAD\|PROPFIND\|DELETE\|CONNECT\|PATCH\|OPTIONS\|TRACE\) .* HTTP\/1.1'
syn match httpResponseLine 'HTTP\/1.1 \d\+ \_[0-9a-zA-Z \-]\+'
syn match httpFieldHost 'Host:.*'
syn match httpFieldConnection 'Connection:.*'
syn match httpFieldUserAgent 'User-Agent:.*'
syn match httpFieldAccept 'Accept:.*'
syn match httpFieldReferer 'Referer:.*'
syn match httpFieldAcceptEncoding 'Accept-Encoding:.*'
syn match httpFieldAcceptLanguage 'Accept-Language:.*'
syn match httpFieldCookie 'Cookie:.*'
syn match httpFieldDate 'Date:.*'
syn match httpFieldServer 'Server:.*'
syn match httpFieldEtag 'Etag:.*'
syn match httpFieldContentLength 'Content-Length:.*'
syn match httpFieldContentType 'Content-Type:.*'
syn match httpFieldLastModified 'Last-Modified:.*'
syn match httpFieldKeepAlive 'Keep-Alive:.*'
syn match httpFieldCacheControl 'Cache-Control:.*'
syn match httpFieldXRequestedWith 'X-Requested-With:.*'
syn match httpFieldIfModifiedSince 'If-Modified-Since:.*'
syn match httpFieldAuthorization 'Authorization:.*'
syn match httpFieldDepth 'Depth:.*'
syn match httpFieldAcceptRanges 'Accept-Ranges:.*'
syn match httpFieldUpgradeInsecureRequests 'Upgrade-Insecure-Requests:.*'
syn match httpFieldOrigin 'Origin:.*'

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" color definitions (specific)
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"hi txtUrl        term=bold        cterm=bold  ctermfg=blue    gui=underline     guifg=blue
"hi txtTitle     term=bold       cterm=bold      ctermfg=black   gui=bold        guifg=black
hi httpRequestLine term=bold cterm=bold ctermfg=red
hi httpResponseLine term=bold cterm=bold ctermfg=yellow
hi httpFieldHost term=bold cterm=bold ctermfg=blue
hi httpFieldConnection term=bold cterm=bold ctermfg=blue
hi httpFieldUserAgent term=bold cterm=bold ctermfg=blue
hi httpFieldAccept term=bold cterm=bold ctermfg=blue
hi httpFieldReferer term=bold cterm=bold ctermfg=blue
hi httpFieldAcceptEncoding term=bold cterm=bold ctermfg=blue
hi httpFieldAcceptLanguage term=bold cterm=bold ctermfg=blue
hi httpFieldCookie term=bold cterm=bold ctermfg=blue
hi httpFieldDate term=bold cterm=bold ctermfg=blue
hi httpFieldServer term=bold cterm=bold ctermfg=blue
hi httpFieldEtag term=bold cterm=bold ctermfg=blue
hi httpFieldContentLength term=bold cterm=bold ctermfg=blue
hi httpFieldContentType term=bold cterm=bold ctermfg=blue
hi httpFieldLastModified term=bold cterm=bold ctermfg=blue
hi httpFieldKeepAlive term=bold cterm=bold ctermfg=blue
hi httpFieldCacheControl term=bold cterm=bold ctermfg=blue
hi httpFieldXRequestedWith term=bold cterm=bold ctermfg=blue
hi httpFieldIfModifiedSince term=bold cterm=bold ctermfg=blue
hi httpField term=bold cterm=bold ctermfg=blue
hi httpFieldAuthorization term=bold cterm=bold ctermfg=blue
hi httpFieldDepth term=bold cterm=bold ctermfg=blue
hi httpFieldAcceptRanges term=bold cterm=bold ctermfg=blue
hi httpFieldUpgradeInsecureRequests term=bold cterm=bold ctermfg=blue
hi httpFieldOrigin term=bold cterm=bold ctermfg=blue

" Read the C++ syntax to start with
"if version < 600
"  so <sfile>:p:h/cpp.vim
"else
"  runtime! syntax/cpp.vim
"  unlet b:current_syntax
"endif



let b:current_syntax = 'http'
" vim:tw=0:et
